using Microsoft.AspNetCore.Mvc;

namespace log_trace_service.Controllers;

[ApiController]
[Route("[controller]/[action]")]
public class UUIDController : ControllerBase
{
    private readonly ILogger<UUIDController> _logger;

    public UUIDController(ILogger<UUIDController> logger)
    {
        _logger = logger;
    }

    [HttpGet]
    public string Get()
    {
        string clientIpAddress = HttpContext.Connection.RemoteIpAddress?.ToString() ?? "Unknown";
        string uuid = Guid.NewGuid().ToString();
        _logger.LogInformation($"注册请求 uuid: {uuid}, 客户端 IP: {clientIpAddress}");
        return uuid;
    }
}